#define _CRT_SECURE_NO_WARNINGS 1

#include"list.h"

struct A
{
	int _a1;
	int _a2;

	A(int a1 = 1, int a2 = 1)
		:_a1(a1)
		,_a2(a2)
	{}
};

void test1()
{
	//zjx::list<int> it1;
	//it1.push_back(1);
	//it1.push_back(2);
	//it1.push_back(3);
	//it1.push_back(4);

	//zjx::list<int>::iterator it = it1.begin();
	//while(it != it1.end())
	//{
	//	cout << *it << " ";
	//	++it;
	//}
	//cout << endl;

	zjx::list<A> it1;
	it1.push_back({1,1});
	it1.push_back({2,2});
	it1.push_back({3,3});
	it1.push_back({ 4,4 });
	it1.push_back({5,5});

	zjx::list<A>::iterator it = it1.begin();
	while (it != it1.end())
	{
		//cout << (*it)._a1 << ":" << (*it)._a2 << endl;
		cout << it->_a1 << ":" << it->_a2 << " ";
		++it;
	}
	cout << endl;

	it1.pop_back();
	it = it1.begin();
	while (it != it1.end())
	{
		//cout << (*it)._a1 << ":" << (*it)._a2 << endl;
		cout << it->_a1 << ":" << it->_a2 << " ";
		++it;
	}
	cout << endl;

	it1.pop_front();
	it = it1.begin();
	while (it != it1.end())
	{
		//cout << (*it)._a1 << ":" << (*it)._a2 << endl;
		cout << it->_a1 << ":" << it->_a2 << " ";
		++it;
	}
	cout << endl;

	it1.push_front({ 10,10 });
	it = it1.begin();
	while (it != it1.end())
	{
		//cout << (*it)._a1 << ":" << (*it)._a2 << endl;
		cout << it->_a1 << ":" << it->_a2 << " ";
		++it;
	}
	cout << endl;

	zjx::list<A> it2(it1);
	it = it2.begin();
	while (it != it2.end())
	{
		//cout << (*it)._a1 << ":" << (*it)._a2 << endl;
		cout << it->_a1 << ":" << it->_a2 << " ";
		++it;
	}
	cout << endl;
}

void test2()
{
	zjx::list<int> lt1 = { 1, 2 , 3 , 4 };
	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;

	zjx::list<int> lt2 = { 4,6,10 };
	for (auto e : lt2)
	{
		cout << e << " ";
	}
	cout << endl;

	lt2 = lt1;
	for (auto e : lt1)
	{
		cout << e << " ";
	}
	cout << endl;
}

int main()
{
	test2();
	return 0;
}